// import Vue from 'vue'
import Vue from 'vue'
import { Col } from 'view-design'

Vue.prototype.$show = new Vue({
	methods: {
		show1(params) {
			let option = {
				title: params.title ? params.title : '标题',
				content: params.content ? params.content : '内容',
				success: params.success ? params.success : '已确定',
				cancel: params.cancel ? params.cancel : '已取消',
			}
			return new Promise((resolve, reject) => {
				this.$Modal.confirm({
					title: option.title,
					content: option.content,
					onOk: () => {
						if (params.success !== 'not') {
							this.$Message.success(option.success)
						}
						resolve()
					},
					onCancel: () => {
						// this.$Message.info(option.cancel)
						reject()
					},
				})
			})
    },
    open2(message ='') {
      this.$Notice.warning({
        title: '提示',
        desc: message
    });
    },

	},
})

Vue.prototype.$rex = new Vue({
	methods: {
		acc(str) {
			str = str.toString()

			if (str.match(/^[\-0-9a-zA-Z-\.\@]{5,10}$/)) {
				return true
			}
			return false
		},
		name(str) {
		  str = str.toString()
		  	if (str.match(/^[\-0-9a-zA-Z-\u4e00-\u9fa5-\.\@]{1,10}$/)) {
				return true
			}
			return false

    	},
		address(str){
		str = str.toString()
			if (str.match(/^[\-0-9a-zA-Z-\u4e00-\u9fa5-\.\@]{1,50}$/)) {
				return true
			}
			return false
		},
		money(str){
			str = str.toString()
			if (str.match(/^[1-9]\d*$/)) {
				return true
			}
			return false
		},
		pwdcheck(str){
			str = str.toString()
			if (str.match(/^[\-0-9a-zA-Z-\.\@]{8,16}$/)) {
				return true
			}
			return false
		},
		phoneNum(str){
			str = str.toString()
			if (str.match(/^1[3|4|5|6|7|8|9][0-9]{9}$/)) {
				return true
			}
			return false
		},
		
	},
})
const imgArr = ['jpg', 'png', 'gif', 'jpeg']

Vue.prototype.$file = new Vue({
	data() {
		return {
			imgArr,
		}
	},
	methods: {
		img(str) {
      let fileType = str.split('/')[1]
      let flag = false
			this.imgArr.forEach((v) => {

        
				if (v.indexOf(fileType) !== -1) {
          
          flag = true
					
				}
			})

			return flag
		},
	},
})
